<extend name="Public/base"/>

<block name="body">

	 <link href="__NEW_CSS__/list.css" rel="stylesheet">
	 <div class="am-container">
		 <h2 style="font-size:16px;">搜索词：{$keyword}</h2>
	 	<div class="am-g">
	 		<include file="Public:goods_list" />
	 	</div>	 	
	 </div>
    <script>
    $(function(){
	    $(".goods-list li").hover(
	    function(){
	       //当鼠标放上去的时候,程序处理
	       $(this).addClass("hover1 hover");
	    },
	    function(){
	       //当鼠标离开的时候,程序处理
	       $(this).removeClass("hover1 hover");
	    });
	    $('.goods-list').find('li').each(function(){
			a = $('.goods-list').innerWidth()/4*1.4;
			b = $('.goods-list').innerWidth()/4*0.95;
			$(this).find('.goods-pic').each(function(){
				$(this).innerHeight(Math.round(b)-1);	
			});
			$(this).innerHeight(Math.round(a)-1);	
		});
	   
	    $('#next').click(function(){
		  	LoadPage(); 
		  	$('#next').attr('disabled',true);
		  	$('#next').addClass('disabled');
		});
	});
    function LoadPage(){
		var currentPage = $('#next').attr('p') ? $('#next').attr('p') : 1;
		$.get("{:U('Search/index',array('keywords'=>$keyword))}",{p:currentPage},function(result){
			$('#next').attr('disabled',false);
			$('#next').removeClass('disabled');
			if(result.errno==0){
				$('.goods-list ul').append(result.content);
				$('#next').attr('p',result.p);
				if(result.p>$('#next').attr('total-page')){
					$('#next').html('木有了，亲');
					$('#next').attr('disabled',true);
					$('#next').addClass('disabled');
				}
			}
		},'json');	
	}
    </script>
</block>